//
//  MRTruthDareButtonCell.m
//  MoRan
//
//  Created by MoRan  on 2023.
//  Copyright © 2023年 MoRan . All rights reserved.
//

#import "MRTruthDareButtonCell.h"

@implementation MRTruthDareButtonCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    // Background Code
}

- (void)setData:(id)data delegate:(id)delegate {
    _delegate = delegate;
    
    if ([data isKindOfClass:[NSDictionary class]]) {
        if ([data[@"data"] isKindOfClass:[MRTruthDareButtonCellModel class]]) {
            MRTruthDareButtonCellModel *model = data[@"data"];
            _model = model;
            [_myButton setTitle:[NSString stringWithFormat:@"%@",model.title] forState:UIControlStateNormal];
        }
    }
}

- (IBAction)buttonAction:(UIButton *)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(truthDareButtonCell:button:)]) {
        [_delegate truthDareButtonCell:self button:sender];
    }
}

@end


#pragma mark - Model

@implementation MRTruthDareButtonCellModel

+ (MRTruthDareButtonCellModel *)ittemModelWithTitle:(NSString *)title {
    MRTruthDareButtonCellModel *model = [MRTruthDareButtonCellModel new];
    model.title = kSafeString(title);
    return model;
}

@end
